home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programmer Power Tools
/
Programmer Power Tools.iso
/
icon
/
cross.icn
< prev
next >
Wrap
Text File
|
1985-12-03
|
699b
|
31 lines
#
# W O R D I N T E R S E C T I O N S
#
# This program procedure accepts string pairs from standard input, with
# the strings separated by semicolons. It then diagrams all the
# intersections of the two strings in a common character.
procedure main()
local line, j
while line := read() do {
write()
j := upto(':',line)
cross(line[1:j],line[j+1:0])
}
end
procedure cross(s1,s2)
local j, k
every j := upto(s2,s1) do
every k := upto(s1[j],s2) do
xprint(s1,s2,j,k)
end
procedure xprint(s1,s2,j,k)
write()
every write(right(s2[1 to k-1],j))
write(s1)
every write(right(s2[k+1 to *s2],j))
end